﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UofCASE.AgileProductLinerDSL {
    public partial class AgileProductLinerDSLDeleteClosure {

        public override Microsoft.VisualStudio.Modeling.VisitorFilterResult ShouldVisitRolePlayer(Microsoft.VisualStudio.Modeling.ElementWalker walker, Microsoft.VisualStudio.Modeling.ModelElement sourceElement, Microsoft.VisualStudio.Modeling.ElementLink elementLink, Microsoft.VisualStudio.Modeling.DomainRoleInfo targetDomainRole, Microsoft.VisualStudio.Modeling.ModelElement targetRolePlayer) {

            TestPortReferencesFeaturePorts tPortRefsFeatPort = elementLink as TestPortReferencesFeaturePorts;
            if (tPortRefsFeatPort != null) {
                TestPort testPort = targetRolePlayer as TestPort;
                if (testPort != null) {
                    if (testPort.FeaturePorts.Count < 2) {
                        return Microsoft.VisualStudio.Modeling.VisitorFilterResult.Yes;
                    } else return Microsoft.VisualStudio.Modeling.VisitorFilterResult.DoNotCare;
                } else {
                    FeaturePort featurePort = targetRolePlayer as FeaturePort;
                    if (featurePort != null) {
                        return Microsoft.VisualStudio.Modeling.VisitorFilterResult.Yes;
                    } else
                        return Microsoft.VisualStudio.Modeling.VisitorFilterResult.DoNotCare;
                }
            } else return base.ShouldVisitRolePlayer(walker, sourceElement, elementLink, targetDomainRole, targetRolePlayer);
        }

    }
}
